package com.yzzrjy.controller.mainservlet.update;

import com.yzzrjy.Service.UserService;
import com.yzzrjy.util.ResponseUtils;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

@WebServlet(name = "UpdateAlbumServlet", value = "/updateAlbum")
public class UpdateAlbumServlet extends HttpServlet {
    private UserService userService = new UserService();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String uid = request.getParameter("uid");
        String album = request.getParameter("album");
        if(uid == null || album == null){
            ResponseUtils.parameterError(response);
            return;
        }
        try {
            List<String> list = userService.updateAlbum(uid, album);
            ResponseUtils.success(response, list);
        } catch (SQLException e) {
            ResponseUtils.otherError(response, "上传失败");
        }
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
